import request from '../../utils/request';

export interface FormVO {
  id: number;
  name: string;
  conf: string;
  fields: string[];
  status: number;
  remark: string;
  createTime: string;
}

// BPM 表单管理 API
export const FormApi = {
  // 创建工作流的表单定义
  createForm: async (data: FormVO) => {
    return await request.post('/bpm/form/create', data);
  },

  // 更新工作流的表单定义
  updateForm: async (data: FormVO) => {
    return await request.put('/bpm/form/update', data);
  },

  // 删除工作流的表单定义
  deleteForm: async (id: number) => {
    return await request.delete(`/bpm/form/delete?id=${id}`);
  },

  // 获得工作流的表单定义
  getForm: async (id: number) => {
    return await request.get(`/bpm/form/get?id=${id}`);
  },

  // 获得工作流的表单定义分页
  getFormPage: async (params: any) => {
    return await request.get('/bpm/form/page', { params });
  },

  // 获得动态表单的精简列表
  getFormSimpleList: async () => {
    return await request.get('/bpm/form/simple-list');
  }
};